Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Add CI workflow for package release on tag push #195

Merged
merged 5 commits into from
Dec 20, 2020

Conversation

goanpeca
Copy link
Contributor

@goanpeca goanpeca commented Oct 15, 2020

  • Simplify release process with package publishing on CI
  • Adds a check-manifest step
  • Uses bump2version (the maintained fork)

@goanpeca goanpeca force-pushed the release-process branch 2 times, most recently from 4f39bc7 to 9e96c87 Compare October 15, 2020 00:58
@goanpeca
Copy link
Contributor Author

goanpeca commented Oct 15, 2020

@MSeal, still a WIP, but this simplifies a bit the release procedure so that the artifacts can be released on CI based on a tag.

I suggest we use tags that start with v so that we can trigger this with v* in case there are other different tags in the future?

The process would be now:

# Updates to release version and creates a commint and a tag
bump2version release --tag
# Updates to patch dev version and creates a commit
bump2version patch

# Pushes things
git push upstream master
# This will trigger a CI workflow to publish packages
git push upstream --tags

(Assuming upstream poitns to this repo and not a fork, we can update this)

This would make two commits from dev to relase and from release no next patch dev version.

On CI packages would be published to NPM (needs to create a token) and PYPi (needs to create a token)

Need to double check how tokens work with NPM publish.

Thoughts?

.bumpversion.cfg Outdated
@@ -1,20 +1,27 @@
[bumpversion]
current_version = 5.0.8.dev
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(.(?P<suffix>.+))?
current_version = 5.0.9.dev0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the build part to the version, since it seems to be more standard/valid?

parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(.(?P<suffix>.+))?
current_version = 5.0.9.dev0
commit = True
message = Bump version: {current_version} → {new_version}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can do the commit directly

.bumpversion.cfg Outdated
commit = True
message = Bump version: {current_version} → {new_version}
tag = False
tag_name = v{new_version}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And add the tag directly

- name: Publish NPM Package
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would need to be created on PyPI and set on the Settings secrets

# Handle token for NPM?
# https://docs.npmjs.com/using-private-packages-in-a-ci-cd-workflow
run: |
npm publish
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to create this token also, but I am not sure how it needs to be provided to the npm publish command (maybe create the npmrc file as the link above?)

@goanpeca goanpeca changed the title PR: Add CI workflow for pakcage release on tag push PR: Add CI workflow for package release on tag push Oct 15, 2020
@goanpeca
Copy link
Contributor Author

@MSeal let me know what you think :).

@MSeal
Copy link
Contributor

MSeal commented Oct 19, 2020

Hi Sorry @goanpeca I'm going to be fairly unresponsive for a bit as I had a new addition to the family over the weekend.

I like moving to github actions where possible and I'm not opposed to automating releases, though I've not automated any of the jupyter repos for PyPI / npm release so far since it's sometimes good to have a human take the steps explicitly. In this case I'd check with @rgbkrk, @minrk, or @takluyver in case on of them is free / has an opinion.

@goanpeca
Copy link
Contributor Author

I'm going to be fairly unresponsive for a bit as I had a new addition to the family over the weekend.

Congratulations! and sure, no problem.

I have been automating this way a lot of other projects and I think it makes maintenance much easier and shareable among other team members.

This optimizes for having more maintainers, which is something we struggle to find in open source.

@rgbkrk
Copy link
Member

rgbkrk commented Oct 21, 2020

I'm a fan of automating this. The credentials piece is usually the trickiest bit, since it needs to be encrypted in the repo but accessible by automation. What's the plan for that?

@goanpeca
Copy link
Contributor Author

What's the plan for that?

Github secrets basically.

@willingc
Copy link
Member

@goanpeca Hi! Do you want to finish this up and then we can cut a release with all the open PRs?

@willingc willingc mentioned this pull request Nov 21, 2020
6 tasks
@goanpeca
Copy link
Contributor Author

@goanpeca Hi! Do you want to finish this up and then we can cut a release with all the open PRs?

Hi @willingc, yes. I need to make sure the npm bits work as expected so I will try it on a personal repo with a dummy npm package.

Once I get that workin I will come an update the PR.

Cheers

@goanpeca goanpeca marked this pull request as ready for review November 29, 2020 22:17
@goanpeca
Copy link
Contributor Author

Should we remove python 3.5 support?

@goanpeca
Copy link
Contributor Author

I think this one is ready @willingc. Before we can test this, we need to add 2 Repository secrets to the Settings of this repo.

PYPI_TOKEN and NPM_TOKEN

To create the pypi one, one needs to go to https://pypi.org/manage/account/token/ and create a token for the specific package. I would suggest using a bot account (jupyter-bot) to automate this process and avoid having CI workflows attached to personal accounts.

To create the NPM one, one needs to go to https://www.npmjs.com/settings//tokens and create a new automation token. Same suggestion from before, using a bot-account is probably a better idea to handle this automation processes.

These values should be added as the secrest rspectively.


I am not currently a maintainer of this project but I would be happy to help with it and set things up, and help moving things forward :)

@willingc
Copy link
Member

@goanpeca Check your inbox. I've bumped your privileges so that you can enable the secrets needed.

@goanpeca
Copy link
Contributor Author

Awesome @willingc.

Now I (only) need access to https://pypi.org/project/nbformat/
Screen Shot 2020-11-30 at 11 47 42

Anyone in there should be able to bump me :)

And on https://www.npmjs.com/package/nbformat

Screen Shot 2020-11-30 at 11 48 18

I think @rgbkrk has access to both, you could add me, if you agree of course.

Cheers!

@willingc
Copy link
Member

willingc commented Dec 1, 2020

@minrk @rgbkrk Would one of you be able to add @goanpeca and me to the pypi account and the npm account? I'm willingc on both. Thanks!

@rgbkrk
Copy link
Member

rgbkrk commented Dec 15, 2020

Will do. What are your logins for each @goanpeca?

The npm package is actually called nbformat-schema. I'll add you now @willingc.

Update: done

@rgbkrk
Copy link
Member

rgbkrk commented Dec 16, 2020

It looks like Jupyterlab has an nbformat package that could/should be automated to receive these updates too, unless the purpose of the package is different: https://www.npmjs.com/package/@jupyterlab/nbformat

@goanpeca
Copy link
Contributor Author

Hi @rgbkrk, thanks.

goanpeca on every platform :) I can ask tomorrow on the the JLab weekly meeting about @jupyterlab/nbformat to be sure.

@rgbkrk
Copy link
Member

rgbkrk commented Dec 16, 2020

@goanpeca -- all set for npm and PyPI. I think you have to accept the invite (somehow?)

@goanpeca
Copy link
Contributor Author

@rgbkrk received! Thanks :)

@rgbkrk
Copy link
Member

rgbkrk commented Dec 16, 2020

Let me know when this is ready to merge, otherwise feel free to go forward with it @goanpeca.

@goanpeca
Copy link
Contributor Author

Thanks, will look into this later today :)

@MSeal MSeal merged commit f404fcb into jupyter:master Dec 20, 2020
@goanpeca goanpeca deleted the release-process branch December 20, 2020 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants